load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//prow:def.bzl", "prow_image")

NAME = "needs-rebase"

prow_image(
    name = "image",
    component = NAME,
    visibility = ["//visibility:public"],
)

go_library(
    name = "go_default_library",
    srcs = ["main.go"],
    importpath = "k8s.io/test-infra/prow/external-plugins/needs-rebase",
    visibility = ["//visibility:private"],
    deps = [
        "//pkg/flagutil:go_default_library",
        "//prow/config/secret:go_default_library",
        "//prow/external-plugins/needs-rebase/plugin:go_default_library",
        "//prow/flagutil:go_default_library",
        "//prow/github:go_default_library",
        "//prow/interrupts:go_default_library",
        "//prow/labels:go_default_library",
        "//prow/pjutil:go_default_library",
        "//prow/pluginhelp/externalplugins:go_default_library",
        "//prow/plugins:go_default_library",
        "@com_github_sirupsen_logrus//:go_default_library",
    ],
)

go_binary(
    name = NAME,
    embed = [":go_default_library"],
    pure = "on",
    visibility = ["//visibility:public"],
)

filegroup(
    name = "package-srcs",
    srcs = glob(["**"]),
    tags = ["automanaged"],
    visibility = ["//visibility:private"],
)

filegroup(
    name = "all-srcs",
    srcs = [
        ":package-srcs",
        "//prow/external-plugins/needs-rebase/plugin:all-srcs",
    ],
    tags = ["automanaged"],
    visibility = ["//visibility:public"],
)
